//
//  AppDelegate.swift
//  mmda
//
//  Created by 李陆涛 on 2018/4/13.
//  Copyright © 2018年 mmda. All rights reserved.
//

import UIKit
import IQKeyboardManagerSwift
import Toast_Swift
import Bugly
import DeviceKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    var mapManager:BMKMapManager?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        setup(launchOptions)
        
        return true
    }
    
    func setup(_ launchOptions: [UIApplicationLaunchOptionsKey: Any]?) {
        
        IQKeyboardManager.shared.enable = true
        IQKeyboardManager.shared.shouldResignOnTouchOutside = true
        
        IQKeyboardManager.shared.enabledDistanceHandlingClasses = [CommentVC.self]
        
        ToastManager.shared.position = .center
        
        
        Bugly.start(withAppId: "d1fcb4ac9f")
        
        
        DispatchQueue.global().async {
            
            [weak self] in
            guard let `self` = self else { return }
            
            self.mapManager = BMKMapManager()
            self.mapManager?.start("ShvR91c11AECi94iIecdAIr3ggLbuu8S", generalDelegate: nil)
            
            BMKLocationAuth.sharedInstance().checkPermision(withKey: "ShvR91c11AECi94iIecdAIr3ggLbuu8S", authDelegate: nil)
            
            let device = Device()
            AppManager.share.platform = device.description;
        }
        
    }
}
